package com.nhh.v.service;

import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import com.nhh.exception.ServiceException;
import com.nhh.v.mapper.*;
import com.nhh.v.model.*;
import com.nhh.v.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * User: Allen.qin
 * Date: 2018/9/4
 */
@Service
@Transactional
public class ConfigService {

    @Autowired
    private NhhwakConfigMapper nhhwakConfigMapper;


    public Map<String, Object> getHashRateConfig() {

        NhhwakConfig config = nhhwakConfigMapper.getHashRateConfig();
        Map<String, Object> data = Maps.newHashMap();
        data.put("perHashrate", config.getGamePerHashrate());
        data.put("gameMaxHashrate", config.getGameMaxHashrate());
        data.put("duration", config.getGameHashrateDuration());
        return data;
    }

    public Map<String, Object> qrHashrateCfg() {
        Map<String, Object> data = Maps.newHashMap();
        data.put("cfg",nhhwakConfigMapper.getAllHashRateConfig());
        return data;
    }
}
